1. Field of the Invention
The present invention relates to performing arithmetic operations on interval operands within a computer system. More specifically, the present invention relates to a method and an apparatus for representing arithmetic intervals within a computer system to facilitate efficient arithmetic operations on the intervals.
2. Related Art
Rapid advances in computing technology make it possible to perform trillions of computational operations each second. This tremendous computational speed-makes it practical to perform computationally intensive tasks as diverse as predicting the weather and optimizing the design of an aircraft engine. Such computational tasks are typically performed using machine-representable floating-point numbers to approximate values of real numbers. (For example, see the Institute of Electrical and Electronics Engineers (IEEE) standard 754 for binary floating-point numbers.)
Floating-point numbers are generally used to perform most computational tasks in spite of their limitations.
One limitation is that machine-representable floating-point numbers have a fixed-size word length, which limits their accuracy. Note that a floating-point number is typically encoded using a 32, 64 or 128-bit binary number, which means that there are only 232, 264 or 2128 possible symbols that can be used to specify a floating-point number. Hence, most real number values can only be approximated with a corresponding floating-point number. This creates estimation errors that can be magnified through even a few computations, thereby adversely affecting the accuracy of a computation.
A related limitation is that floating-point numbers contain no information about their accuracy. Most measured data values include some amount of error that arises from the process used to measure the data values. This error can often be quantified as an accuracy parameter, which can subsequently be used to determine the accuracy of a computation. However, floating-point numbers are not designed to keep track of accuracy information, whether from input data measurement errors or machine rounding errors. Hence, it is not possible to determine the accuracy of a computation by merely examining a floating-point number that results from the computation.
Interval arithmetic has been developed to solve the above-described problems. Interval arithmetic represents numbers as intervals specified by a first (left) endpoint and a second (right) endpoint. For example, the interval [a, b], where a less than b, is a closed, bounded subset of the real numbers, R, which includes a and b as well as all real numbers between a and b. Arithmetic operations on interval operands (interval arithmetic) are defined so that interval results always contain the entire set of possible values. The result is a mathematical system for rigorously bounding numerical errors from all sources, including measurement data errors, machine rounding errors and their interactions. (Note that the first endpoint normally contains the xe2x80x9cinfimumxe2x80x9d, which is the largest number that is less than or equal to each of a given set of real numbers. Similarly, the second endpoint normally contains the xe2x80x9csupremumxe2x80x9d, which is the smallest number that is greater than or equal to each of the given set of real numbers. One aspect of the present invention is directed to swapping the infimum and the supremum between the first endpoint and the second endpoint for representational purposes.)
However, computer systems are presently not designed to efficiently handle intervals and interval computations. Consequently, performing interval operations on a typical computer system can be hundreds of times slower than performing conventional floating-point operations. In addition, without a special representation for intervals, interval arithmetic operations fail to produce results that are as narrow as possible.
What is needed is a method and an apparatus for representing arithmetic intervals within a computer system that facilitates both efficient arithmetic operations on interval operands and interval results that are as narrow as possible. (Interval results that are as narrow as possible are said to be xe2x80x9csharpxe2x80x9d.)
One embodiment of the present invention provides a system for representing intervals within a computer system to facilitate efficient interval arithmetic operations. The system operates by receiving a pair of interval representations. Each representation includes a first floating-point number normally representing a first endpoint of the interval and a second floating-point number normally representing a second endpoint of the interval. Next, the system performs an arithmetic operation using the interval pair to produce a result. In performing interval arithmetic operations, if an interval""s first endpoint is negative infinity and its second endpoint is finite, the system treats the first endpoint as the result of a negative overflow toward negative infinity. On the other hand, if an interval""s second endpoint is positive infinity and the first endpoint is finite, the system treats the second endpoint as the result of a positive overflow toward positive infinity.
In one embodiment of the present invention for performing interval arithmetic operations, if the second endpoint is negative zero and the first endpoint is less than or equal to the closest negative floating-point number to zero, the system treats the second endpoint as a negative underflow toward zero. On the other hand, if the first endpoint is positive zero and the second endpoint is greater than or equal to the closest positive floating-point number to zero, the system treats the first endpoint as a positive underflow toward zero.
In one embodiment of the present invention for performing interval arithmetic operations, if the second endpoint is positive zero and the first endpoint is either negative zero, or less than or equal to the closest negative floating-point number to zero, the system treats the second endpoint as zero. On the other hand, if the first endpoint is negative zero and the second endpoint is either positive zero, or greater than or equal to the closest positive floating-point number to zero, the system treats the first endpoint as zero.
In one embodiment of the present invention for performing interval arithmetic operations, if the first endpoint is positive infinity and the second endpoint is finite, the system treats the first endpoint as negative infinity. On the other hand, if the second endpoint is negative infinity and the first endpoint is finite, the system treats the second endpoint as positive infinity.
In one embodiment of the present invention for performing interval arithmetic operations, if the first endpoint and the second endpoint are both finite and the first endpoint has a larger value than the second endpoint, the system treats the interval as the union of two semi-infinite intervals (or an exterior interval) comprising a lower interval bounded by negative infinity and the second endpoint, and an upper interval bounded by the first endpoint and positive infinity.
In one embodiment of the present invention, the first floating-point number and the second floating-point number conform to IEEE standard 754 for binary floating-point numbers.
In one embodiment of the present invention, performing interval arithmetic operations involves performing, an interval additional operation, an interval subtraction operation, an interval multiplication operation or an interval division operation. In a variation on this embodiment, the interval operands and the interval result of performing the interval arithmetic operation can be either interior intervals or exterior intervals.
In one embodiment of the present invention for performing interval arithmetic operations, if the first and second interval endpoints of either interval operand or both are non-default not-a-number (NaN) values, the system treats the intervals as the empty interval, which is the same as the empty set.